﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AutomationMLObjectRepresentationTemplateSelector.cs" >
//   J. Prinz
// </copyright>
// <summary>
//   the representation of any AutomationML Object is selected with the DataTemplateSelector
//   the DataTemplateSelector selects a DataTemplate according to the Type of the ViewModel, representing
//   the CAEX-Type
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace AutomationMLMapper.Controls.ConvertersAndTemplateSelectors
{
    using System.Windows;
    using System.Windows.Controls;

    using AutomationMLMapper.ViewModels.CAEXObjectViewModels;

    /// <summary>
    ///   the representation of any AutomationML Object is selected with the DataTemplateSelector
    ///   the DataTemplateSelector selects a DataTemplate according to the Type of the ViewModel, representing
    ///   the CAEX-Type
    /// </summary>
    public class AutomationMLObjectRepresentationTemplateSelector : DataTemplateSelector
    {
        #region Public Properties

        /// <summary>
        ///   DataTemplate for representation of Attribute ViewModel <see cref="AttributeViewModel" />
        /// </summary>
        public DataTemplate AttributeTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of ExportInternalElement ViewModel <see cref="ExportInternalElementViewModel" />
        /// </summary>
        public DataTemplate ExportInternalElementTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of ImportInternalElement ViewModel <see cref="ImportInternalElementViewModel" />
        /// </summary>
        public DataTemplate ImportInternalElementTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of InternalElement ViewModel <see cref="InternalElementViewModel" />
        /// </summary>
        public DataTemplate InternalElementTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of MappingType ViewModel <see cref="MappingTypeViewModel" />
        /// </summary>
        public DataTemplate MappingTypeTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of PropertySet ViewModel <see cref="PropertySetViewModel" />
        /// </summary>
        public DataTemplate PropertySetTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of RequiredRoleClass ViewModel <see cref="RoleClassViewModel" />
        /// </summary>
        public DataTemplate RequiredRoleClassTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of RoleClassLib ViewModel <see cref="RoleClassLibViewModel" />
        /// </summary>
        public DataTemplate RoleClassLibTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of RoleClass ViewModel <see cref="RoleClassViewModel" />
        /// </summary>
        public DataTemplate RoleClassTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of SupportedRoleClass ViewModel <see cref="RoleClassViewModel" />
        /// </summary>
        public DataTemplate SupportedRoleClassTemplate { get; set; }

        /// <summary>
        ///   DataTemplate for representation of SytemUnitClass ViewModel <see cref="SystemUnitClassViewModel" />
        /// </summary>
        public DataTemplate SytemUnitClassTemplate { get; set; }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// Selector method
        /// </summary>
        /// <param name="item">
        /// </param>
        /// <param name="container">
        /// </param>
        /// <returns>
        /// The System.Windows.DataTemplate. 
        /// </returns>
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is AttributeViewModel)
            {
                return this.AttributeTemplate;
            }

            if (item is RoleClassViewModel)
            {
                return this.RoleClassTemplate;
            }

            if (item is SystemUnitClassViewModel)
            {
                return this.SytemUnitClassTemplate;
            }

            if (item is PropertySetViewModel)
            {
                return this.PropertySetTemplate;
            }

            if (item is ImportInternalElementViewModel)
            {
                return this.ImportInternalElementTemplate;
            }

            if (item is ExportInternalElementViewModel)
            {
                return this.ExportInternalElementTemplate;
            }

            if (item is InternalElementViewModel)
            {
                return this.InternalElementTemplate;
            }

            if (item is RoleClassLibViewModel)
            {
                return this.RoleClassLibTemplate;
            }

            if (item is MappingTypeViewModel)
            {
                return this.MappingTypeTemplate;
            }

            return null;
        }

        #endregion
    }
}